package com.fastCms.business.frame.enums;

/**
 * 哈密瓜科技 版权所有 © Copyright 2019<br>
 *
 * @Description: 登录权限控制<br>
 * @Project: hami <br>
 * @CreateDate: Created in 2019/3/7 下午3:48 <br>
 * @Author: <a href="lsquan666@163.com">lsquan</a>
 */
public enum CloudAdminTypeEnum {
    SYSTEM_USER(0, "系统用户"),
    SYSTEM_ADMIN(1, "系统管理员"),
    SUPER_ADMIN(2, "超级管理员");

    private int code;
    private String name;

    CloudAdminTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static CloudAdminTypeEnum getEnum(int code) {
        for (CloudAdminTypeEnum item : CloudAdminTypeEnum.values()) {
            if (item.code == code) {
                return item;
            }
        }
        return null;
    }

    /**
     * 根据code获取name
     *
     * @param code
     * @return
     */
    public static String getName(int code) {
        CloudAdminTypeEnum item = getEnum(code);
        return item != null ? item.name : null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int key) {
        this.code = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


}
